package com.simpleframe.views.chart.attribution;

/**
 * 实现图表的动画效果
 * @author Administrator
 *
 */
public class ChartElementsOnShow {
	
	/**
	 * 发散效果（仅对线状图有效）
	 */
	public static final String TYPE_EXPLODE ="explode";
	/**
	 * 渐变效果
	 */
	public static final String TYPE_FADE_IN = "fade-in";
	/**
	 * 从中间平移效果
	 */
	public static final String TYPE_MID_SLIDE = "mid-slide";
	/**
	 * 从下向上展现
	 */
	public static final String TYPE_POP_UP ="pop-up";
	
	/**
	 * 从上向下展现
	 */
	public static final String TYPE_DROP="drop";
	
	/**
	 * 从左向右逐渐展现（仅对线状图有效）
	 */
	public static final String TYPE_SHRINK_IN="shrink-in"; 
	
	/**
	 * 动画类型，值请参考静态属性
	 */
	private String type;
	
	/**
	 * 动画时长
	 */
	private double cascade;
	
	/**
	 * 延时多少秒开始动画
	 */
	private double delay;
	
	ChartElementsOnShow(){
	}

	public ChartElementsOnShow(String type, double cascade, double delay) {
		this.type = type;
		this.cascade = cascade;
		this.delay = delay;
	}
	
	/**
	 * 默认设定
	 */
	public void DefaultSetting(){
		type = new String();
		cascade = 1;
		delay = 0.5;
	}
	
	/**
	 * 将动画效果以字符串形式返回
	 * @return
	 */
	public String getOnShowString(){
		StringBuffer sb = new StringBuffer();
		sb.append("\t");
		sb.append(ChartTool.addQuotes("on-show") + ":");
		sb.append("{");

		sb.append(ChartTool.addQuotes("type") + ":");
		sb.append(ChartTool.addQuotes(type) + ",");

		sb.append(ChartTool.addQuotes("cascade") + ":");
		sb.append(ChartTool.checkField(""+cascade) + ",");

		sb.append(ChartTool.addQuotes("delay") + ":");
		sb.append(ChartTool.checkField(""+delay));

		sb.append("},\n");
		return sb.toString();
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public double getCascade() {
		return cascade;
	}

	public void setCascade(double cascade) {
		this.cascade = cascade;
	}

	public double getDelay() {
		return delay;
	}

	public void setDelay(double delay) {
		this.delay = delay;
	}
	
	
}
